#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(int argc, char const *argv[])
{
    //用户名不分大小写 降序排列
    vector<string>nickname;
    nickname.push_back("Adan Lanbert");
    nickname.push_back("Chris");
    nickname.push_back("Zenda");
    nickname.push_back("Samda");
    nickname.push_back("Jelly Bean");
    sort(nickname.begin(), nickname.end(), [](const string& str1, const string& str2) -> bool
    {
        //复制要排序的字符串值,以免改变原值
        string str1Copy, str2Copy;
        str1Copy.resize(str1.size());
        str2Copy.resize(str2.size());
        transform(str1.begin(), str1.end(), str1Copy.begin(), ::tolower);
        transform(str2.begin(), str2.end(), str1Copy.begin(), ::tolower);
        return str1Copy < str2Copy; //升序
    });
    for_each(nickname.begin(), nickname.end(), [](const string& Element){
        cout << Element << endl;
    });
    return 0;
}
